<?php

App::uses('AppModel', 'Model');

class KalkulatorNalepnica extends AppModel {
    
    public $useTable = 'kalkulator_takse';
    
    public function calculate($data) {
        $value = array();
        
        $takse = $this->find('all', array(
            'fields'     => array('company', 'account', 'value'),
            'conditions' => array(
                'vrsta_takse' => 'nalepnica'
            )
        ));
        if ($takse) {
            foreach ($takse as $taksa) {
                $value[] = $taksa[$this->name];
            }
        }
        
        return $value;
    }
    
}
